const axios = require("axios");
const systemModule = require('../func/system-module').init();
const systemConfig = require('../func/system-config').init();
const orgStruct = require('../func/org-Struct').init();
const partnersDict = require('../func/partners-dict').init();
const curUserInfo = require('../func/cur-user-info').init();
const iframeDict = require('../func/iframe-dict').init();
const degree = require('../func/data-degree').init();
const cmsSiteMenu=require('../func/cms-site-menu').init();
const cmsArticleLabel=require('../func/cms-article-label').init();
module.exports = class {
    constructor() {
        this.config = global.Config;
        this.webTools = global.webTools;
        this.DB = global.DataBase;
        this.moment = global.moment;
        this.func = {
            systemModule: systemModule,
            systemConfig: systemConfig,
            orgStruct: orgStruct,
            partnersDict: partnersDict,
            curUserInfo: curUserInfo,
            iframeDict: iframeDict,
            degree: degree,
            cmsSiteMenu:cmsSiteMenu,
            cmsArticleLabel:cmsArticleLabel
        };
        this.http = this.http();
    }

    static init() {
        return new this();
    }

    loadLogic(path, params) {
        let realPath = `../../logic/${path}`;
        return require(realPath).init(params);
    }

    http() {
        let get = async function (url, params) {
            return await axios(url, {
                params: params
            });
        };


        let post = async function (url, params) {
            return await axios(url, params);
        };

        return {
            get: get,
            post: post
        }

    }

};
